﻿using System;
using System.Collections;
using Huirui.Cavan.Domain.MainBoundedContext.SystemModule;
using Huirui.Cavan.Domain.Seedwork;
using Huirui.Cavan.Domain.MainBoundedContext.PurchaseModule;
using Huirui.Cavan.Domain.MainBoundedContext.SalesModule;
using System.Collections.Generic;

namespace Huirui.Cavan.Domain.MainBoundedContext.StockModule
{
    #region WareHouse

    /// <summary>
    /// WareHouse object for NHibernate mapped table 'WareHouse'.
    /// </summary>
    [Serializable]
    public class WareHouse : Persistent<string>
    {
        #region Member Variables

        protected string _address;
        protected SystemIdentifier.WareHouseStatus _status;
        protected Corporation _corporation;
        protected Department _department;
        protected Employee _employee;
        protected IList<PurchaseOrderDetail> _purchaseOrderDetails;
        protected IList<SalesOrderDetail> _salesOrderDetails;
        protected IList<Stock> _stocks;
        protected IList<StockExchange> _stockExchanges;
        protected IList<StockExchangeDetail> _stockExchangeDetails;
        protected IList<StockInOutDetail> _stockInDetails;
        protected IList<StockOutApplyDetail> _stockOutApplyDetails;

        #endregion

        #region Constructors

        public WareHouse() { }

        public WareHouse(string id, string address, SystemIdentifier.WareHouseStatus status, DateTime createDate, DateTime modifyDate, int editUser, Corporation corporation, Department department, Employee employee)
        {
            this.Id = id;
            this._address = address;
            this._status = status;
            this._createDate = createDate;
            this._modifyDate = modifyDate;
            this._editUser = editUser;
            this._corporation = corporation;
            this._department = department;
            this._employee = employee;
        }

        #endregion

        #region Public Properties


        public virtual string Address
        {
            get { return _address; }
            set
            {
                if (value != null && value.Length > 200)
                    throw new ArgumentOutOfRangeException("Invalid value for Address", value, value.ToString());
                _address = value;
            }
        }

        public virtual SystemIdentifier.WareHouseStatus Status
        {
            get { return _status; }
            set { _status = value; }
        }

        public virtual Corporation Corporation
        {
            get { return _corporation; }
            set { _corporation = value; }
        }

        public virtual Department Department
        {
            get { return _department; }
            set { _department = value; }
        }

        public virtual Employee Employee
        {
            get { return _employee; }
            set { _employee = value; }
        }

        public virtual IList<PurchaseOrderDetail> PurchaseOrderDetails
        {
            get
            {
                if (_purchaseOrderDetails == null)
                {
                    _purchaseOrderDetails = new List<PurchaseOrderDetail>();
                }
                return _purchaseOrderDetails;
            }
            set { _purchaseOrderDetails = value; }
        }

        public virtual IList<SalesOrderDetail> SalesOrderDetails
        {
            get
            {
                if (_salesOrderDetails == null)
                {
                    _salesOrderDetails = new List<SalesOrderDetail>();
                }
                return _salesOrderDetails;
            }
            set { _salesOrderDetails = value; }
        }

        public virtual IList<Stock> Stocks
        {
            get
            {
                if (_stocks == null)
                {
                    _stocks = new List<Stock>();
                }
                return _stocks;
            }
            set { _stocks = value; }
        }

        public virtual IList<StockExchange> StockExchanges
        {
            get
            {
                if (_stockExchanges == null)
                {
                    _stockExchanges = new List<StockExchange>();
                }
                return _stockExchanges;
            }
            set { _stockExchanges = value; }
        }

        public virtual IList<StockExchangeDetail> StockExchangeDetails
        {
            get
            {
                if (_stockExchangeDetails == null)
                {
                    _stockExchangeDetails = new List<StockExchangeDetail>();
                }
                return _stockExchangeDetails;
            }
            set { _stockExchangeDetails = value; }
        }

        public virtual IList<StockInOutDetail> StockInDetails
        {
            get
            {
                if (_stockInDetails == null)
                {
                    _stockInDetails = new List<StockInOutDetail>();
                }
                return _stockInDetails;
            }
            set { _stockInDetails = value; }
        }

        public virtual IList<StockOutApplyDetail> StockOutApplyDetails
        {
            get
            {
                if (_stockOutApplyDetails == null)
                {
                    _stockOutApplyDetails = new List<StockOutApplyDetail>();
                }
                return _stockOutApplyDetails;
            }
            set { _stockOutApplyDetails = value; }
        }

        #endregion
    }
    #endregion
}